<!DOCTYPE html>
<html>
<head>
    <title>Pull to refresh</title>
    <meta charset="utf-8">
    <link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.mobile.all.min.css" rel="stylesheet" />
    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/kendo.all.min.js"></script>
    <script src="../content/shared/js/console.js"></script>
    <script>
        
    </script>
    
    
</head>
<body>
    
        <a class="offline-button" href="../index.html">Back</a>
    
    <div data-role="view" data-title="Pull to refresh" id="scroller-refresh-view" data-init="initPullToRefreshScroller">
    <br/>
    <div id="pull-cat"></div>
    <h2 id="pull-to-refresh-clock"></h2>
</div>

<style scoped>
    #pull-cat {
        margin: 0 auto 15px;
        overflow: hidden;
        width: 18em;
        height: 18em;
        border-radius: 1000px;
        -webkit-border-radius: 1000px;
        border: 8px solid silver;
        box-shadow: inset 0 0 5px rgba(0,0,0,.3);
        -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,.3);
        background-size: auto 150%;
        background-position: 50% 50%;
        background-repeat: no-repeat;
    }

    .km-ios #pull-cat {
        border: 8px solid #000;
    }

    #pull-to-refresh-clock {
        font-size: 1.2em;
        padding: 10px 0 0 0;
        text-align: center;
    }

    .km-ios #pull-to-refresh-clock {
        color: #ccc;
    }

    .km-ios #scroller-refresh-view .km-navbar
    {
        background: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0, rgba(255, 255, 255, 0.5)), color-stop(0.06, rgba(255, 255, 255, 0.45)), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(1, rgba(100, 100, 100, 0))), url(../content/shared/images/patterns/pattern1.png);
        background: -moz-linear-gradient(center top , rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.45) 6%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.15) 50%, rgba(100, 100, 100, 0)), url(../content/shared/images/patterns/pattern1.png);
	}

    .km-ios #scroller-refresh-view .km-navbar .km-button {
        background-color: #000;
    }

    .km-ios #scroller-refresh-view .km-content {
        background: url(../content/shared/images/patterns/pattern6.png);
        box-shadow: inset 0 0 40px #000;
    }

    .km-tablet .km-ios #scroller-refresh-view .km-view-title {
        color: #fff;
        text-shadow: 0 -1px rgba(0,0,0,.5);
    }

</style>
<script>
    var pullTime, dataSource, image, counter = 0;

    function updateClock() {
        if (!dataSource.at(counter+1))
            counter = 0;

        $("#pull-cat").css("background-image", "url('" + dataSource.at(counter++).media.m.replace(/_m\.jpg/i, ".jpg") + "')");
        pullTime = kendo.toString(new Date(), "hh:mm:ss tt" );
        $("#pull-to-refresh-clock").html("Last update at " + pullTime + ". <br /> Pull to refresh.");
    }

    function initPullToRefreshScroller(e) {
        dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "http://api.flickr.com/services/feeds/photos_public.gne",
                    dataType: "jsonp",
                    jsonpCallback: "jsonFlickrFeed",
                    data: {
                        tags: "cat,face",
                        format: "json"
                    }
                }
            },
            schema: {
                data: "items"
            }
        });

        dataSource.fetch(updateClock);

        var scroller = e.view.scroller;

        scroller.setOptions({
            pullToRefresh: true,
            pull: function() {
                updateClock();
                setTimeout(function() { scroller.pullHandled(); }, 400);
            }
        })
    }
</script>



    
    <script>
        window.kendoMobileApplication = new kendo.mobile.Application(document.body);
    </script>
    
    
</body>
</html>
